﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace pretextexe_tests {
    public static class TestPretextFilesGenerator {

        public const string TestDirectory = @"TestPretextFiles";
        public static bool TestFilesGenerated = false;
        public static string TestFilesPath = String.Empty;

        public static string EnsureAndGetTestFilesPath() {

            if (TestFilesGenerated) return TestFilesPath;

            DirectoryInfo testPretextFilesDirectory = Directory.CreateDirectory(TestDirectory);

            // create a test file
            File.WriteAllText(TestDirectory + @"\" + @"viewData.html.pretext", "My name is <%= NAME %>.");

            TestFilesGenerated = true;
            TestFilesPath = testPretextFilesDirectory.FullName;
            return TestFilesPath;

        }

    }
}
